import Top from "../home/component/top";
import React, {useEffect, useState} from "react";
import MyFooter from "../home/component/myFooter";
import {DatePicker, Input, Layout} from "antd";
import axios from "axios";
import ImageUpload from "./ImageUpload";

const {  Content } = Layout;
const Register  = () => {
      const [user,setUser] = useState({
          username: '',
          password: '',
          phone:'',
          gender:'',
          birthday:'',
          address:'',
          idpicpath:''
      });

    const getSelf =  async () => {
        try {
            const response = await axios.get(`http://localhost:8084/user/${sessionStorage.getItem('id')}`, {})
            setUser(response.data.data)
        } catch (error) {
            console.error(error);
        }
    }


    return(
        <>
            <Layout className="layout">
                <Top></Top>
                <Content style={{ padding: '0 100px' , marginTop : '20px'}}>
                    <div className="layui-col-md4 layui-col-md-offset4">

                        <fieldset className="layui-elem-field layui-field-title" style={{marginTop: '50px'}}>
                            <legend>注册</legend>
                        </fieldset>

                        <form className="layui-form" action="${pageContext.request.contextPath}/user/update1" method="post"
                              lay-filter="example" encType="multipart/form-data">


                            <div className="layui-form-item">
                                <div className="layui-col-md-12">
                                    <label className="layui-form-label">头像</label>
                                </div>

                                <div className="layui-col-lg-offset3">
                                    <ImageUpload/>
                                </div>
                                <a name="list-progress"> </a>
                                <div style={{marginTop: '10px',marginLeft: '10px'}}>
                                </div>
                            </div>

                            <div className="layui-form-item">
                                <label className="layui-form-label">手机号</label>
                                <div className="layui-input-inline">
                                    <input type="text" name="phone" id="phone" lay-verify="title" autoComplete="off"
                                           placeholder="请输入手机号" className="layui-input"
                                    />
                                </div>
                            </div>
                            <div className="layui-form-item">
                                <label className="layui-form-label">密码</label>
                                <div className="layui-input-inline">
                                    <input type="password"
                                           placeholder="请输入手机号" className="layui-input"
                                    />
                                </div>
                            </div>
                            <div className="layui-form-item">
                                <label className="layui-form-label">地址</label>
                                <div className="layui-input-inline">
                                    <input type="text" name="phone" id="phone" lay-verify="title" autoComplete="off"
                                           placeholder="请输入手机号" className="layui-input"
                                    />
                                </div>
                            </div>
                            <div className="layui-form-item">
                                <label className="layui-form-label">名称</label>
                                <div className="layui-input-inline">
                                    <input type="text" name="username" lay-verify="title" autoComplete="off"
                                           placeholder="请输入名称" className="layui-input"  />
                                </div>
                            </div>
                            <div className="layui-form-item">
                                <label className="layui-form-label">生日</label>
                                <div className="layui-input-inline">
                                    <DatePicker   />
                                </div>

                            </div>

                            <div className="layui-form-item">
                                <label className="layui-form-label">性别</label>
                                <div className="layui-input-block">
                                    <input type="radio" name="sex" value="男" title="男" checked="true"/>
                                        <input type="radio" name="sex" value="女" title="女"/>
                                </div>
                            </div>


                            <hr/>

                            <div className="layui-form-item">
                                <div className="layui-input-block">
                                    <button type="submit" className="layui-btn" lay-submit="" lay-filter="demo1">注册
                                    </button>
                                </div>
                            </div>

                        </form>
                    </div>
                </Content>
                <MyFooter></MyFooter>
            </Layout>

        </>

    )
}
export default Register;